// TODO  aclEntry.delete(); 

CalendarService = Packages.com.google.gdata.client.calendar.CalendarService;
gdata           = Packages.com.google.gdata.data;
AclEntry        = Packages.com.google.gdata.data.acl.AclEntry;
AclScope        = Packages.com.google.gdata.data.acl.AclScope
CalendarAclRole = Packages.com.google.gdata.data.calendar.CalendarAclRole
AclFeed         = Packages.com.google.gdata.data.acl.AclFeed

function main( ui ) { 

    var service = new CalendarService("demo-calendar-1");
    
    var username = "soulsoftware2010@gmail.com";
    var password = "2010soulsoftware";
    var userToRemove="vincenzo.tandurella@gmail.com"
    service.setUserCredentials(username, password);
    try {
           
           var aclUrl =
             new java.net.URL("https://www.google.com/calendar/feeds/"+username+"/acl/full");    
           var aclFeed = service.getFeed(aclUrl,AclFeed);
      
           for (var i=0;i<aclFeed.getEntries().size();i++) {
              var aclEntry=aclFeed.getEntries().get(i);
              if (userToRemove.equals(aclEntry.getScope().getValue())) {
                //aclEntry.delete();
                break;
            }
           }
        }
    catch( e ) {
    
        return e;
    }
    
    return "OK";

}

